<style>
#map{
	width: 750upx;
	height: 800upx;
}
</style>
<template>
	<view>
		<map id="map" :markers="markers" :latitude="latitude" :longitude="longitude"></map>
		
	</view>
</template>

<script>
	import QQMapWX from '../../../common/qqmap-wx-jssdk.js'
	
	export default {
		data() {
			return {
				qqmap:null,
// 				latitude:38.075,
// 				longitude:114.5114,
				latitude:null,
				longitude:null,
				markers:[
// 					{
// 						id:'6',
// 						latitude:38.075,
// 						longitude:114.5114,
// 						iconPath:'../../../static/img/marker_red.png'
// 					}
				]
				
			};
		},
		onLoad(options) {
			// console.log(options.address);
			let that = this 
			let qqkey = '5WCBZ-VLY6V-FJDPK-UP3DH-DHH66-I5FT7'
			this.qqmap = new QQMapWX({
				key: qqkey
			})
			this.qqmap.geocoder({
				address: options.address,
				success:function(res){
					console.log(res);
					let latitude = res.result.location.lat 
					let longitude = res.result.location.lng
					that.latitude = latitude
					that.longitude = longitude	
					let marker = {
							id:'6',
							latitude:latitude,
							longitude:longitude,
							iconPath:'../../../static/img/marker_red.png'
						}
					that.markers = [marker]
				}
			})
			
			
// 			plus.maps.Map.geocode(options.address,{},function(event){
// 				var address = event.address; 
// 				var point = event.coord;  
// 				var coordType = event.coordType;
// 				let type = typeof point
// 				that.latitude = point.latitude
// 				that.longitude = point.longitude	
// 				let marker = {
// 						id:'6',
// 						latitude:point.latitude,
// 						longitude:point.longitude,
// 						iconPath:'../../../static/img/marker_red.png'
// 					}
// 				that.markers = [marker]
// 				uni.showModal({
// 					content:JSON.stringify(point)
// 				})
// 				uni.showModal({
// 					content:JSON.stringify(address)
// 				})
// 			},function(e){
// 			});
		}
	}
</script>
